home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / dev / e / cha_source.lha / cha_source / debug.e < prev    next >
Encoding:
Text File  |  1999-12-18  |  1.8 KB  |  57 lines

  1. /*==========================================================================+
  2. | debug.e                                                                   |
  3. | debugging macros                                                          |
  4. +--------------------------------------------------------------------------*/
  5.  
  6. OPT PREPROCESS
  7. OPT MODULE
  8. OPT EXPORT
  9.  
  10. /*-------------------------------------------------------------------------*/
  11.  
  12. ->#define DEBUG
  13.  
  14. #ifdef DEBUG
  15. #define debug(x) _debug(x)
  16. #endif
  17.  
  18. #ifndef DEBUG
  19. #define debug(x)
  20. #endif
  21.  
  22. /*-------------------------------------------------------------------------*/
  23.  
  24. #ifdef DEBUG
  25.  
  26. RAISE "MEM" IF String() = NIL
  27.  
  28. PROC _debug(list : PTR TO LONG)
  29.     DEF l
  30.     IF CtrlC() THEN Raise("^C")
  31.     WriteF('+++ Debug: ')
  32.     l := ListLen(list)
  33.     SELECT l
  34.     CASE 1;  WriteF(list[0])
  35.     CASE 2;  WriteF(list[0], list[1])
  36.     CASE 3;  WriteF(list[0], list[1], list[2])
  37.     CASE 4;  WriteF(list[0], list[1], list[2], list[3])
  38.     CASE 5;  WriteF(list[0], list[1], list[2], list[3], list[4])
  39.     CASE 6;  WriteF(list[0], list[1], list[2], list[3], list[4], list[5])
  40.     CASE 7;  WriteF(list[0], list[1], list[2], list[3], list[4], list[5], list[6])
  41.     CASE 8;  WriteF(list[0], list[1], list[2], list[3], list[4], list[5], list[6], list[7])
  42.     CASE 9;  WriteF(list[0], list[1], list[2], list[3], list[4], list[5], list[6], list[7], list[8])
  43.     DEFAULT; Raise("dbug")
  44.     ENDSELECT
  45.     WriteF('\n')
  46. ENDPROC
  47.  
  48. PROC complex2string(z : PTR TO LONG) IS StringF(String(40), '\s + \s i', float2string(z[0]), float2string(z[1]))
  49.  
  50. PROC float2string(f) IS RealF(String(16), f, 6)
  51.  
  52. #endif
  53.  
  54. /*--------------------------------------------------------------------------+
  55. | END: debug.e                                                              |
  56. +==========================================================================*/
  57.